<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style type="text/css">
        #box1{
            width: 200px;
            height: 200px;
            background-color: red;
        }
        
    </style>
</head>
<body>
    <button id="b1" ></button>
    <div id="box1"></div>


    
</body>

<script>
    window.onload=function(){
        var b1=document.getElementById("b1");
        var box1=document.getElementById("box1");
        b1.innerText="click,me"
        b1.onclick=function(){
            /* 
                修改box1的长度和宽度
                通过js进行修改：
                    语法:元素.style.样式名=样式值
            */

            box1.style.width="100px";
            box1.style.height="100px";

            /* 
                如果样式名含有-,例如：background-color
                    需要将二者合并,且驼峰命名
            
            */

            box1.style.backgroundColor="yellow"
        
        }

    }

</script>
</html>